package com.github.shuaidd.rest.runtime;

import lombok.RequiredArgsConstructor;
import org.activiti.app.model.runtime.TaskRepresentation;
import org.activiti.app.model.runtime.TaskUpdateRepresentation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

@RestController("lwfTaskResource")
@RequestMapping("app")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
public class TaskResource extends AbstractTaskResource {

    @Override
    @RequestMapping(value = "/rest/tasks/{taskId}",
            method = RequestMethod.GET,
            produces = "application/json")
    public TaskRepresentation getTask(@PathVariable String taskId, HttpServletResponse response) {
        return super.getTask(taskId, response);
    }

    @Override
    @RequestMapping(value = "/rest/tasks/{taskId}",
            method = RequestMethod.PUT,
            produces = "application/json")
    public TaskRepresentation updateTask(@PathVariable("taskId") String taskId, @RequestBody TaskUpdateRepresentation updated) {
        return super.updateTask(taskId, updated);
    }
}
